package servlet;

import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.db.conn;

public class roomtype_Edit extends HttpServlet {


	public roomtype_Edit() {
		super();
	}


	public void destroy() {
		super.destroy(); 
	}

	//编辑房型信息
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;");
		PrintWriter out = response.getWriter();

        //声明数据库操作类
		conn cn = new conn();

		//接收传递过来的值
        String id=request.getParameter("id");
        String rname=request.getParameter("txt_rname");
        String rpic=request.getParameter("fujian");
        String rpice=request.getParameter("txt_rpice");
        String rmemo=request.getParameter("txt_rmemo");
		
		
        String sql="update roomtype set rname = '"+rname+"',rpic = '"+rpic+"',rpice = "+rpice+",rmemo = '"+rmemo+"' where rid='"+id+"'";

       
		
	
		//执行sql
		cn.update(sql);		

		out.println("<script>");
		out.println("alert('操作成功');");
		out.println("window.location='admin/roomtype/roomtype_Manage.jsp'");
		out.println("</script>");
	
		out.flush();
		out.close();
	}


	public void init() throws ServletException {
		// Put your code here
	}

}

